package com.flipdf2.serialize.ppml.element;

import org.jdom.Element;
import org.jdom.Namespace;

import com.flipdf2.serialize.ppml.PPMLException;

public class PPMLView {
	public static final String NAME = "VIEW";

	private PPMLTransform transform;
	private PPMLClipRect clipRect;

	public Element toXML(Namespace defaultNamespace) {
		Element root = null;
		if (defaultNamespace != null) {
			root = new Element(NAME, defaultNamespace);
		} else {
			root = new Element(NAME);	
		}

		if (transform != null)
			root.addContent(transform.toXML(defaultNamespace));
		if (clipRect != null)
			root.addContent(clipRect.toXML(defaultNamespace));

		return root;
	}

	public void check() throws PPMLException {
	}
	
	public PPMLClipRect getClipRect() {
		return clipRect;
	}

	public void setClipRect(PPMLClipRect clipRect) {
		this.clipRect = clipRect;
	}

	public PPMLTransform getTransform() {
		return transform;
	}

	public void setTransform(PPMLTransform transform) {
		this.transform = transform;
	}
}
